home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / utilities / boot / tlpatch204.lha / tlpatch / V2.04 / Source / Translate204.c < prev   
Encoding:
C/C++ Source or Header  |  1994-12-25  |  1.1 KB  |  55 lines

  1. /* Translate204.c            */
  2. /* adapted from Translate.c  */
  3. /* adapted from RKM pp 3-145 */
  4.  
  5. #include <exec/types.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <exec/exec.h>
  10. #include <exec/nodes.h>
  11. #include <exec/lists.h>
  12. #include <exec/memory.h>
  13. #include <exec/interrupts.h>
  14. #include <exec/libraries.h>
  15. #include <exec/io.h>
  16. #include <exec/tasks.h>
  17. #include <exec/execbase.h>
  18. #include <libraries/translator.h>
  19. #include <proto/exec.h>
  20. #include <proto/translator.h>
  21.  
  22. struct Library *TranslatorBase = 0;
  23. UBYTE *phonemes[500];
  24. WORD rtncode;
  25.  
  26. extern struct Library *OpenLibrary();
  27.  
  28. int main(int argc, char *argv[])
  29. {
  30.     if (argc < 2)
  31.     {
  32.         printf("Usage: %s <text>\n", *argv);
  33.         exit(0);
  34.     }
  35.  
  36.     if ( (TranslatorBase = (struct Library *)OpenLibrary("translator.library", 0L)) == NULL)
  37.     {
  38.         printf("Can't open the translator library\n");
  39.         exit(-100);
  40.     }
  41.  
  42.     if ( (rtncode = Translate(argv[1], strlen(argv[1]), (STRPTR)phonemes, 500)) != 0)
  43.         printf("Translator error - %d\n", rtncode);
  44.     else
  45.     {
  46.         printf("\n    Text = %s\n", argv[1]);
  47.         printf("Phonemes = %s\n\n", phonemes);
  48.     }
  49.  
  50.     if (TranslatorBase != 0)
  51.         CloseLibrary(TranslatorBase);
  52.  
  53.     exit(0);
  54. }
  55.